import { init, h } from 'snabbdom'
// 1. 导入模块
import style from 'snabbdom/modules/style'
import eventListerner from 'snabbdom/modules/eventlisteners'
// 2. 注册模块
let patch = init([style, eventListerner])
// 3. h中使用模块所需数据

let vnode = h('div', {
  style: {
    backgroundColor: 'red'
  },
  on: {
    click: eventHandler
  }
},[
  h('h1', 'hello Snabbdom'),
  h('p', 'ppppp')
])

function eventHandler() {
  console.log('点击了');
}

let app = document.querySelector('#app')

patch(app, vnode)
